// 角色管理路由
const express = require('express');
const roleController = require('../controllers/roleController.js');
const {authMiddleware} = require('../middlewares/authMiddleware');
const {apiPathMiddleware} = require('../middlewares/apiPathMiddleware');

const router = express.Router();

// 添加角色
router.post('/save', 
  authMiddleware, 
  apiPathMiddleware('role/save'), 
  roleController.saveRole
);
// 删除角色
router.delete('/remove/:id', 
  authMiddleware, 
  apiPathMiddleware('role/remove'), roleController.removeRole);
// 编辑角色
router.put('/update', 
  authMiddleware, 
  apiPathMiddleware('role/update'), roleController.editRole);
// 获取角色列表
router.get('/:page/:limit/', 
  authMiddleware, 
  apiPathMiddleware('role'), roleController.getAllRoles);

module.exports = router;